# coding:utf-8
from PyQt6.QtWidgets import QWidget
from qfluentwidgets import IndeterminateProgressRing, IndeterminateProgressBar


class ProgressWidget(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.progress_ring = IndeterminateProgressRing(self)
        self.progress_bar = IndeterminateProgressBar(self)

        self.setFixedSize(100, 100)
        self.progress_bar.move(0, 0)
        self.progress_ring.move(0, 0)
        self.progress_ring.setFixedSize(100, 100)
        self.progress_bar.setFixedSize(100, 100)

        self.progress_bar.setVisible(False)
        self.progress_ring.setVisible(True)

    def setValue(self, value: int | float):
        self.progress_bar.setValue(int(value))
        self.progress_ring.setVisible(False)
